<?php
error_reporting(E_ALL);
#error_reporting(0);
include('include/config.inc.php');
?>	 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//DE"> 
<html>
<head>
<meta http-equiv="Content-Language" content="de">
<title><?php echo $lang['titlesearch']; ?></title>
<meta name="Description" content="OpenCDR WEB Call Detail Records">
<meta http-equiv="imagetoolbar" content="no">
<link rel="stylesheet" href="cdr.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="10">
 <td width="50" background="images/header-bg.gif"></td>
  
</tr>
<tr>
<td><a href="https://www.swyx-forum.com/forum/167-open-cdr/" target="_blank"><img align="right" src="images/top.jpg" border="0"></a><h1>&nbsp;&nbsp;<?php echo $lang['title']; ?></h1><br></td>
</tr>



<tr height="43">
 <td background="images/tab-off-red.gif">
	 <table border="0" cellspacing="0" cellpadding="0">
	 	<tr height="43">
	 	 <td width="43">&nbsp;</td>

		 <td width="2" background="images/menu-sep-red.gif"></td>
	 	 <td width="34" background="images/tab-off-red.gif"></td>
	 	 <td width="80" background="images/tab-off-red.gif" class="menuidle"><a href="index.php"><?php echo $lang['newquery']; ?></a></td>
	 	 <td width="34" background="images/tab-off-red.gif"></td>
	 	 
		 <td width="2" background="images/menu-sep-red.gif"></td>
	 	 <td width="34" background="images/tab-left-off-red.gif"></td>
	  	 <td width="80" background="images/tab-off-red.gif" class="menuidle"><a href="topx.php">Top 50</a></td>
	 	 <td width="34" background="images/tab-right-off-red.gif"></td>
		 
		  <td width="2" background="images/menu-sep-red.gif"></td>
	 	 <td width="34" background="images/tab-left-on-red.gif"></td>
	 	 <td width="80" background="images/tab-on-red.gif" class="menu"><a href="setup.php">Setup</a></td>
	 	  <td width="34" background="images/tab-right-on-red.gif"></td>
	 	 
<!--		 <td width="2" background="images/menu-sep-red.gif"></td>
		 <td width="2" background="images/menu-sep-red.gif"></td>
		 <td width="34" background="images/tab-left-off-red.gif"></td>
	 	 <td width="140" background="images/tab-off-red.gif" class="menuidle"><a href="../index.html">Netphone WebGUI</a></td>
-->	 	 <td width="34" background="images/tab-off-red.gif"></td>
	 	 <td width="2" background="images/menu-sep-red.gif"></td>

	 	</tr>
	 </table>
</table>
	 <!-- Ende Header -->



<form id="searchconstraints" method="post" action="setup.php" style="margin:0px;">
<br>
<div id="summary">
<table cellpadding="0" cellspacing="0" border="0" width="1000">
 <tr height="36">
  <td width="26" background="images/tl-gry.gif">&nbsp;</td>
  <td width="964" background="images/t-gry.gif" colspan="2"><b><font color=white>Datenbank Setups:</font><b></td>
  <td width="10" background="images/tr-gry.gif"></td>
 </tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="1000">
 <tr height="10">
  <td width="10" background="images/mt-l.gif">&nbsp;</td>
  <td width="980" background="images/mt-c.gif" colspan="2">&nbsp;</td>
  <td width="10" background="images/mt-r.gif">&nbsp;</td>
 </tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="1000">
<tr>
	<td width="10" background="images/mb-l.gif">&nbsp;</td>
	<td bgcolor="fbfbfb"></td>
	<td bgcolor="fbfbfb"></td>
	<td width="10" background="images/mb-r.gif"></td>
</tr>


<tr>
	<td width="10" background="images/mb-l.gif">&nbsp;</td>
	<td bgcolor="fbfbfb"><?php echo $lang['deletefromto']; ?></td>
	<td bgcolor="fbfbfb"><input type="text" name="delfromdate" id="delfromdate" value=""></td>
	<td width="10" background="images/mb-r.gif"></td>
</tr>
<tr>
	<td width="10" background="images/mb-l.gif">&nbsp;</td>
	<td bgcolor="fbfbfb"></td>
	<td bgcolor="fbfbfb"></td>
	<td width="10" background="images/mb-r.gif"></td>
</tr>
<tr>
 <td width="10" background="images/mb-l.gif">&nbsp;</td>
 <td bgcolor="fbfbfb"><font color=red><?php echo $lang['deleteall']; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><input type="checkbox" name="deletedb" value="ON"></td>
 <td bgcolor="fbfbfb"></td>
 <td width="10" background="images/mb-r.gif">&nbsp;</td>
</tr>
<tr>
	<td width="10" background="images/mb-l.gif">&nbsp;</td>
	<td bgcolor="fbfbfb"></td>
	<td bgcolor="fbfbfb"></td>
	<td width="10" background="images/mb-r.gif"></td>
</tr>
 <tr>
 <td width="10" background="images/mb-l.gif">&nbsp;</td>
 <!-- <td bgcolor="fbfbfb"><?php echo $lang['excel']; ?>&nbsp;&nbsp;<input type="checkbox" name="export" value="ON"></td> -->
 <td bgcolor="fbfbfb">&nbsp;</td>
 <td bgcolor="fbfbfb"><input type="submit" value="<?php echo $lang['search']; ?>" style="width:150px;">&nbsp;<input type="Reset" value="<?php echo $lang['reset']; ?>" style="width:150px;"></td>
 <td width="10" background="images/mb-r.gif">&nbsp;</td>
</tr>
</table>

<table cellpadding="0" cellspacing="0" border="0" width="1000">
 <tr height="10">
  <td width="10" background="images/b-l.gif">&nbsp;</td>
  <td width="980" background="images/b-c.gif" colspan="2">&nbsp;</td>
  <td width="10" background="images/b-r.gif">&nbsp;</td>
 </tr>
</table>

</div>
</form>
<?php
	# Delete all Data in database
	if ( isset($_POST["deletedb"]) && $_POST["deletedb"]=="ON" )
	{ 
	$sql  = "delete FROM cdr";
	if(!$result = $db->query($sql)) { 
	 		echo "$lang[deleteerror]", "", __LINE__, __FILE__, $sql;
	 		exit;
			}
		else 
		{
		echo "<br><br><h3>&nbsp;&nbsp;$lang[deleteok]</h3><br>";
		}		
	}
	
	# Delete Data "from date" in database
	if ( isset($_POST["delfromdate"]) && $_POST["delfromdate"]!="" )
	{ 
	$sql  = "delete FROM cdr WHERE Startdate < '" . $_POST['delfromdate'] . "'";
	if(!$result = $db->query($sql)) { 
	 		echo "$lang[deleteerror]", "", __LINE__, __FILE__, $sql;
	 		exit;
			}
		else 
		{
		echo "<br><br><h3>&nbsp;&nbsp;$lang[deletebevor]" . $_POST['delfromdate'] . "' $lang[deleted]!</h3><br>";
		}		
	}
?>
</body>

<br>
<center><table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td width="1%" align="center"><font color=#999999></font></td>
  <td width="39%" align="left"><font color=#999999>Powered by Mathias Storck</font></td>  
  <td width="20%" align="center"><font color=#999999></font></td>
  <td width="20%" align=""><font color=#999999></font></td>
  <td width="20%" align="center"><font color=#999999></font></td>
 </tr>
 </table></center>